package com.testjpa.web;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 作者: LCG
 * 日期: 2020/5/18 16:33
 * 描述:
 */

@RestController
@RefreshScope  //刷新配置中心的配置
public class ConfigController {

    @Value("${test}")
    private String test;

    @Value("${test1}")
    private String test1;

    @Value("${test2}")
    private String test2;

    @RequestMapping("test02/{id}")
    public String test02(@PathVariable("id") String id){

        if(id.equals("0")){
           return test;
        }else if(id.equals("1")){
           return test1;
        }else{
            return test2;

        }
    }

}
